package org.grayrabbit.cms.util.lucene;

import java.util.Collection;

import org.apache.lucene.analysis.Analyzer;
import org.wltea.analyzer.dic.Dictionary;
import org.wltea.analyzer.lucene.IKAnalyzer;


public class AnalyzerUtil {
	private static Analyzer analyzer;
	
	public static Analyzer getIkAnalyzer(){
		if(analyzer==null){
			//当为true时，分词器迚行最大词长切分 ；当为false时，分词器迚行最细粒度切
			analyzer = new IKAnalyzer();
		}
		return analyzer;
	}
	
	
	public static void loadWords(Collection<String> words){
		Dictionary.loadExtendWords(words);
	}
	
	public static void loadStodWords(Collection<String> words){
		Dictionary.loadExtendStopWords(words);
	}

}
